package fmt_m

import (
	"fmt"
	"strings"
)

const (
	field_ = `	%-20s %-10s = %d; // %s
`
)

type MessageUnit struct {
	name    string // enum name
	adding  bool   //
	infun   bool
	members [][]string
} //
func (this *MessageUnit) addMember(m ...string) {
	this.members = append(this.members, m)
}
func (this *MessageUnit) fmtstr() string {
	str := ""
	for n, fs := range this.members {
		comm := "" // 注释部分
		if len(fs) >= 3 {
			comm = fs[2]
		}
		rfield := []rune(strings.Title(fs[1]))
		rfield[0] += 32
		str += fmt.Sprintf(field_, fs[0], string(rfield), n+1, comm)
	}
	return str
}
